<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<title>
<c:if test="${q != null && q != '' }">${q }_IT搜索 - </c:if>
<c:if test="${t == 1 }">博客搜索</c:if><c:if test="${t == 2 }">问答搜索</c:if>
 - 第${page }页 - IT答案网
 </title>
<meta name="keywords" content="${q },IT搜索,问题搜索,Web前端,企业架构,编程语言,互联网,系统运维,云计算,数据库,移动开发,JAVA问题,Android问题,IOS问题,c/c++问题,解决方案" />
<meta name="description" content="我的IT知识库-${q }搜索结果" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${path }/view/portal/css/all.css?version=${version }" rel="stylesheet">
<link href="${path }/view/portal/css/prettify.css?version=${version }" rel="stylesheet">
</head>
<body onload="prettyPrint()">
	<jsp:include page="head.jsp"></jsp:include>
	<div class="container container1000">
		<div class="row-fluid m_b_20">
			<div class="span2" id="logo">
				<center>
					<a href="index.html"><img src="view/portal/img/logo-1.png?version=${version }" class="h_30"/></a>
				</center>
			</div>
			<div class="span6">
				<form class="form-search" action="so" name="search-form">
					<div class="input-append span10">
						<center>
							<input type="text" class="span12 search-query" name="q" value='${q }' placeholder='${q }' baiduSug="1">
							<input type="hidden" name="t" value="${t }"/>
							<input type="hidden" name="l" value="${l }"/>
							<input type="hidden" name="g" value="${g }"/>
							<button type="submit" class="btn btn-success">搜索答案</button>
						</center>
					</div>
				</form>
			</div>
			<div class="span4 cost_span visible-desktop">花费 ${costTime }ms 找到${totalRow }条记录</div>
		</div>
		<div class="row-fluid">
			<div class="span9 w_700">
			    <div class="content_div">
				    <ul class="nav nav-tabs">
				      <li><a href="javascript:void(0)"><b style="color:green">类别</b></a></li>
				      <li class='<c:if test="${t == 0 }">active</c:if>'><a href='so?q=${q }&t=0&l=${l }&g=${g }'>全部</a></li>
				      <li class='<c:if test="${t == 1 }">active</c:if>'><a href="so?q=${q }&t=1&l=${l }&g=${g }">博客</a></li>
				      <li class='<c:if test="${t == 2 }">active</c:if>'><a href="so?q=${q }&t=2&l=${l }&g=${g }">问答</a></li>
				      <li>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</li>
				      <li><a href="javascript:void(0)"><b style="color:green">语言</b></a></li>
				      <li class='<c:if test="${l == 0 }">active</c:if>'><a href='so?q=${q }&t=${t }&l=0&g=${g }'>全部</a></li>
				      <li class='<c:if test="${l == 1 }">active</c:if>'><a href="so?q=${q }&t=${t }&l=1&g=${g }">中文</a></li>
				      <li class='<c:if test="${l == 2 }">active</c:if>'><a href="so?q=${q }&t=${t }&l=2&g=${g }">英文</a></li>				      
				    </ul>	
				    <c:if test="${totalRow != 0}">		    
					<c:forEach items="${results }" var="post" varStatus="status">
					<div class="media">
	                  <div class="media-body">
	                    <dt>
	                    <span class="badge badge-success">${10*(page == null ? 0 : (page-1))+status.index+1 }</span>
	                    <a href="<c:if test='${post.typeId == 1 }'>blog</c:if><c:if test='${post.typeId == 2 }'>faq</c:if>/<fmt:formatDate value="${post.postTime }" pattern="yyyy/MM/dd"/>/${post.id }.html" target="_blank" class="title_color">${post.title }<i class="icon-flag"></i></a></dt>
	                    <dd><c:out value="${post.content }" escapeXml="false"></c:out></dd>
	                  </div>
	               </div>
					</c:forEach>
					</c:if>
				   <c:if test="${totalRow == 0}">
				     <span><br/>抱歉，未帮您找到合适的答案。</span>
				   </c:if>					
			    </div>
			  <c:if test="${totalRow != 0}">	   
			    <div class="pagination">
                  <ul>
                  <!-- 前一页 -->
                  <c:if test="${page == 0 || page == 1}">
                    <c:set var="prePage" value="1"></c:set>
                  </c:if>
                  <c:if test="${page != 0 && page != 1 && page != null }">
                    <c:set var="prePage" value="${page - 1 }"></c:set>
                  </c:if>
                  <li class="prePage"><a href="so?q=${q }&t=${t }&l=${l }&g=${g }&page=${prePage }">上一页</a></li>
                  <!-- 中间页面 -->
                  <c:forEach items="${pageIndexs }" var="pageIndex">
                     <c:if test="${pageIndex == page }">
                       <li class="pageIndex active" data="${pageIndex }"><a href="so?q=${q }&t=${t }&l=${l }&g=${g }&page=${pageIndex }">${pageIndex }</a></li>
                     </c:if>
                     <c:if test="${pageIndex != page }">
                       <li class="pageIndex" data="${pageIndex }"><a href="so?q=${q }&t=${t }&l=${l }&g=${g }&page=${pageIndex }">${pageIndex }</a></li>
                     </c:if>
                  </c:forEach>
                  <!-- 最后一页 -->
                  <c:if test="${page == 0 || page == 1}">
                    <c:set var="nextPage" value="2"></c:set>
                  </c:if>
                  <c:if test="${page != 0 && page != 1 && page != null }">
                    <c:set var="nextPage" value="${page + 1 }"></c:set>
                  </c:if>                  
                  <li class="nextPage"><a href="so?q=${q }&t=${t }&l=${l }&g=${g }&page=${nextPage }">下一页</a></li>
                  </ul>
			    </div>
			    <br/>
			  </c:if>
			</div>
			<div class="span3 left_content">
		  	  <div class="list-group-head left_content_head">
		  	      <i class="icon-th-list icon-white"></i><span class="m_left_5">分类标签</span>
		  	  </div>
		  	  <a class="list-group-item <c:if test="${g == 0 }">active</c:if>" href="so?q=${q }&t=${t }&l=${l }&g=0">
		  	       <span class="badge back_green" >
		  	         <c:if test="${totalRow < 10000}">${totalRow }</c:if>
			  	     <c:if test="${totalRow >= 10000}">≈<fmt:formatNumber value="${totalRow/10000}" maxFractionDigits="0"/>万</c:if>
		  	       </span>全部</a>
			  <c:forEach items="${groups }" var="group">
			     <c:set var="groupId" >${group.id }</c:set>
			     <a class="list-group-item <c:if test="${g == groupId }">active</c:if>" href="so?q=${q }&t=${t }&l=${l }&g=${groupId }">
			        <c:if test="${groupCountMap[groupId] != null}">
				        <span class="badge back_green">
				           <c:if test="${groupCountMap[groupId] < 10000}">${groupCountMap[groupId]}</c:if>
				           <c:if test="${groupCountMap[groupId] >= 10000}">≈<fmt:formatNumber value="${groupCountMap[groupId]/10000}" maxFractionDigits="0"/>万</c:if>
				        </span>
			        </c:if>
			        <c:if test="${groupCountMap[groupId] >= 10000}"><i class="icon-fire icon-red"></i></c:if> ${group.gname}</a>
			  </c:forEach>		  
			</div>			
		</div>
	</div>
    <div class="clear">&nbsp;</div>
    <input name="path" value="${path }" type="hidden"/>
    <jsp:include page="bottom.jsp"></jsp:include>
</body>
</html>